#include <iostream>
#include <vector>
#include <set>

using namespace std;

int averageFlowers(vector<int> petals) {
  int ans = 0;
  for (int i = 0; i < petals.size(); ++i) {
    set<double> petalSet;
    int petalSum = 0;
    for (int j = i; j < petals.size(); ++j) {
      petalSet.insert(double(petals[j]));
      petalSum += petals[j];
      if (petalSet.find(double(petalSum) / double(j - i + 1)) != petalSet.end()) {
        ++ans;
      }
    }
  }
  return ans;
}

int main(int argc, char const *argv[]) {
  vector<int> petals = {1, 1, 2, 3};
  cout << averageFlowers(petals) << endl;
  return 0;
}